package com.hoshiibuy.dictionary.controller;


import com.hoshiibuy.dictionary.service.IDataYlhService;
import com.hoshiibuy.dictionary.entity.DataYlhVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author guangjinwei
 * @create 2019-04-15
 */
@RestController
@RequestMapping("dataylh/")
@Api(value = "联行信息管理", tags = {"联行信息操作接口"})
public class DataYlhController {

    private final Logger LOGGER = LoggerFactory.getLogger(DataYlhController.class);

    @Autowired
    private IDataYlhService dataYlhService;


    @RequestMapping(value = "/saveDataYlh", method = RequestMethod.POST)
    @ApiOperation(
            value = "保存联行行信息",
            notes = "保存联行行信息",
            produces = "application/json, application/xml",
            consumes = "application/json, application/xml")
    public void saveDataYlh(DataYlhVo dataYlhVo) {
        dataYlhService.saveDataYlh(dataYlhVo);
    }

    @RequestMapping(value = "/findDataYlhById", method = RequestMethod.GET)
    @ApiOperation(
            value = "单行信息",
            notes = "根据ID查询联行信息",
            produces = "application/json, application/xml",
            consumes = "application/json, application/xml")
    public DataYlhVo findDataYlhById(Integer id) {
        return dataYlhService.findDataYlhById(id);
    }

    @RequestMapping(value = "/findDataYlhList", method = RequestMethod.GET)
    @ApiOperation(
            value = "查询联行信息",
            notes = "查询完整的消息内容列表",
            produces = "application/json, application/xml",
            consumes = "application/json, application/xml")
    public List<DataYlhVo> findDataYlhList(){
        List<DataYlhVo> dataYlhList = dataYlhService.findDataYlhList();
        LOGGER.debug("dataYlhList: " + dataYlhList);
        return dataYlhService.findDataYlhList();
    }

    @RequestMapping(value = "/updateDataYlhById", method = RequestMethod.GET)
    @ApiOperation(
            value = "更新联行信息",
            notes = "更新消息内容列表",
            produces = "application/json, application/xml",
            consumes = "application/json, application/xml")
    public void updateDataYlhById(DataYlhVo dataYlhVo){

        dataYlhService.updateDataYlhById(dataYlhVo);
    }

    @RequestMapping(value = "/delDataYlhById", method = RequestMethod.GET)
    @ApiOperation(
            value = "删除联行信息",
            notes = "根据id删除信息",
            produces = "application/json, application/xml",
            consumes = "application/json, application/xml")
    public void delDataYlhById(Long id){

        dataYlhService.delDataYlhById(id);
    }

    @RequestMapping(value = "/queryDataYlhById", method = RequestMethod.GET)
    @ApiOperation(
            value = "查询联行信息",
            notes = "根据id查询消息内容",
            produces = "application/json, application/xml",
            consumes = "application/json, application/xml")
    public void queryDataYlhById(Long id){

        dataYlhService.queryDataYlhById(id);
    }


}
